<?php
session_start();

include('../connect_db.php');

echo	"
		<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
		<link rel='stylesheet' type='text/css' href='css/style.css' />
		";

if(isset($_POST['adminlog']))
{
	$_SESSION['alogin'] = $_POST['adminname'];
}

if(isset($_GET['id']) && $_GET['id'] == 'logout')
{
	if(empty($_SESSION['alogin']))
	{
		header("refresh:5;url=index.php");
		echo	"
				<div id='page-wrapper'>
					<p><h1><center>DailyMall Administrator Menu</center></h1></p>
					<hr />
					<div id='admin-body'>
						<div id='admin-login'>
						<center><p>U bent al uitgelogged, U kunt opnieuw inloggen.<br /><p>
						<p><a href='index.php>U wordt doorverwezen in 5 seconden of klik hier!</a></p></center>
						</div>
					</div>
				</div>
				";
	}
	else
	{
		unset($_SESSION['alogin']);
		header("refresh:5;url=index.php");
		echo	"
				<div id='page-wrapper'>
					<p><h1><center>DailyMall Administrator Menu</center></h1></p>
					<hr />
					<div id='admin-body'>
						<div id='admin-login'>
						<center><p>U bent nu uitgelogged!</p>
						<p><a href='index.php'>U wordt doorverwezen in 5 seconden of klik hier!</a></p></center>
						</div>
					</div>
				</div>
				";
	}
	
}

else if(empty($_SESSION['alogin']))
{			
	echo	"
			<div id='page-wrapper'>
			<p><h1><center>DailyMall Administrator Menu</center></h1></p>
			<hr />
			<div id='admin-body'>
				<div id='admin-login'>
				<center>
				<p>Log in om toegang te krijgen tot het admin menu!</p>
				<form method='POST' action='".$_SERVER['PHP_SELF']."'>
				<table border='0'>
				<tr>
    			<td><br />
                	<img src='images/block_48.gif' border='0' />
                    <br />
                </td>
              	<td style='text-align:left'><br />
          	    	Username:<br />
   					<input type='text' name='adminname' size='27' />
   				  	<br />
				  	Password:<br />
				  	<input type='password' name='adminpass' size='27' />
                    <br />
		        </td>
  				</tr>
 				<tr>
 			  	<td>
                	&nbsp;
                </td>
 			  	<td style='text-align:left'>
                	<p><input type='submit' name='adminlog' value='Login!' /></p>
                </td>
		 		</tr>
				</table>
				</form>
				<br />
       			</center>
				</div>
  			</div>     	
		</div>
		";
}
else
{
	echo	"
			<div id='page-wrapper'>
			<p><h1><center>DailyMall Administrator Menu</center></h1></p>
			<hr />
			<div id='admin-nav'>
				<div class='admin-nav-img'><a href='index.php'><img src='images/home_48.gif' border='0' /><br />
				Admin Home</a></div>
				<div class='admin-nav-img'><a href='index.php?id=instellingen'><img src='images/config_48.gif' border='0' /><br />
				Instellingen</a></div>
				<div class='admin-nav-img'><a href='index.php?id=sitelinks'><img src='images/download_48.gif' border='0' /><br />
				Sitelinks</a></div>
				<div class='admin-nav-img'><a href='index.php'><img src='images/programsadd_48.gif' border='0' /><br />
				Pagina's</a></div>
				<div class='admin-nav-img'><a href='index.php?id=producten'><img src='images/docadd_48.gif' border='0' /><br />
				Producten</a></div>
				<div class='admin-nav-img'><a href='index.php'><img src='images/rate_48.gif' border='0' /><br />
				Verkoop cijfers</a></div>
				<div class='admin-nav-img'><a href='index.php'><img src='images/group_48.gif' border='0' /><br />
				Gebruikers</a></div>
				<div class='admin-nav-img'><a href='index.php'><img src='images/calendar_48.gif' border='0' /><br />
				Kalender</a></div>
				<div class='admin-nav-img'><a href='index.php'><img src='images/mailbox_48.gif' border='0' /><br />
				Nieuwsbrief</a></div>
				
			</div>
			<div id='admin-logout'>
				<div class='admin-nav-img'><a href='index.php?id=logout'><img src='images/block_48.gif' border='0' /><br />
				Log-out</a></div>
			</div>
			<div class='clear'></div>
			<hr />
			<div id='admin-body'>
			";
			
			switch($_GET['id'])
			{
				case "instellingen":
					include('instellingen.php');
					//$obj = new instellingen;
					echo "instellingen";
					//$obj->start();
					break;					
				case "sitelinks":
					include('sitelinks.php');
					//$obj = new sitelinks;
					//$obj->start();
					break;
				case "producten":
					include('producten.php');
					$obj = new producten;
					$obj->get_productinfo();
					break;
		
				default:
					echo "<h2> Welkom ".$_SESSION['alogin'].",</h2>";	
				break;
			}
			
			
	echo	"
			</div>
			</div>
			";
}



?>

